package com.equipment;

import java.util.NoSuchElementException;

import com.util.EncodingUtil;

/**
 * 国标一次发行
 * @author Administrator
 *
 */
public class IPOResponse {

	private String STX = "55AA"; // 帧开始标志
	private String RSCTL = "00"; // 串口帧序列号
	private String Length = ""; // 数据长度
	private String code = "FD"; // 代码
	private String broadening = "AB"; // 扩展代码

	private String bcc = "";// 异或校验

	public void getIpoResponse(String context) throws Exception{
		// 判断是否是BC指令
		if (!context.substring(12, 14).toUpperCase().equals("D0")) {
			throw new NoSuchElementException("一发命令字错误！");
		}
		// 判断状态是否成功
		if (!context.substring(14, 16).equals("00")) {
			throw new NoSuchElementException("一发失败："+EncodingUtil.getErrorResult(EncodingUtil.hexToDec(context.substring(14, 16))));
		}
	}
}
